package com.atguigu.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName MemberWebController
 * @Description TODO
 * @Detail detail
 * @Author MyPC
 * @Date 2020/7/27
 * @Version 1.0
 */
@Controller
public class MemberWebController {
    @Autowired
    OrderFeignService orderFeignService;

    /**
     * 跳转到订单列表页
     * @return
     */
    @GetMapping("/memberOrder.html")
    public String memberOrder(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
                              Model model){
        Map<String,Object> params=new HashMap<>();
        params.put("page",pageNum.toString());
        R r = orderFeignService.listWithItems(params);
        model.addAttribute("orders",r);
        return "orderList";
    }
}
